package com.st.controller;

import com.st.base.BaseResult;
import com.st.service.GoodsDetailService;
import com.st.vo.GoodsDetailListVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Tag(name = "商品分类",description = "这里包含了所有的商品分类的接口")
@RequestMapping(path = "goodsDetail")
public class GoodsDetailController {

    @Resource
    private GoodsDetailService goodsDetailService;

    @Operation(summary = "商品分类列表查询",description = "商品分类的查询接口非必传可以返回数组列表")
    @Parameters({
            @Parameter(description = "页码",required = false),
            @Parameter(description = "页容量",required =false)
    })
    @RequestMapping(path = "List",method = RequestMethod.GET)
    public BaseResult<GoodsDetailListVo> getList(
            @RequestParam(name = "pageNumber",required = false,defaultValue = "1")Integer pageNumber,
            @RequestParam(name = "pageSize",required = false,defaultValue = "5")Integer pageSize
    ){
       List<GoodsDetailListVo> goodsDetailListVos = goodsDetailService.getList();

       if (goodsDetailListVos!=null&&goodsDetailListVos.size()>0){
            return BaseResult.ok(goodsDetailListVos);
       }
       return BaseResult.error("数据不不正确");
    }
/*为了提交*/
}
